package com.pptv.mtbu.ottflow.service.impl;

import com.pptv.mtbu.ottflow.dao.*;
import com.pptv.mtbu.ottflow.domain.*;
import com.pptv.mtbu.ottflow.vo.*;
import com.pptv.mtbu.ottflow.exception.*;
import com.pptv.mtbu.ottflow.service.*;

import java.util.*;

public class AdminManagerImpl
	implements AdminManager{
	
	protected ChannelDao channelDao;
	protected UserDao    userDao;
	private RoleDao    roleDao;
	protected ProjectDao projectDao;
	
	public ChannelDao getChannelDao() {
		return channelDao;
	}
	public void setChannelDao(ChannelDao channelDao) {
		this.channelDao = channelDao;
	}
	public UserDao getUserDao() {
		return userDao;
	}
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
	public ProjectDao getProjectDao() {
		return projectDao;
	}
	public void setProjectDao(ProjectDao projectDao) {
		this.projectDao = projectDao;
	}
	
    public RoleDao getRoleDao() {
        return roleDao;
    }
    public void setRoleDao(RoleDao roleDao) {
        this.roleDao = roleDao;
    }

	@Override
	public void addUsr(User user) throws OttflowException {

		
	}

	/**
	 * 	int USER_SUPERADMIN = 0;
		int USER_CP = 1;
		int USER_SP = 2;
		int USER_ORM = 3;
		int USER_ADMIN = 4;
	 */
	@Override
	public int validLogin(User user) {
		//TODO 
		return USER_SUPERADMIN;
	}
	
	@Override
	public List<User> findUsrByPage(PageBean pageBean) {
		//TODO 
		return userDao.findByPage(pageBean);
	}
    @Override
    public int findUsrNum() {
        return userDao.findAll().size();
    }
    @Override
    public User findUsrById(int id) {
        return userDao.get(id);
    }
    
    
    @Override
    public List<Role> findAllRoles() {
        return getRoleDao().findAll();
    }
    
	@Override
	public List<User> findUsrByRoleIdByPage(String roleId, PageBean pageBean) {
		return userDao.findUsrByRoleIdByPage(roleId, pageBean);
	}
	
	@Override
	public List<User> findUsrByRoleByPage(Role role, PageBean pageBean) {
		return userDao.findUsrByRoleByPage(role, pageBean);
	}
	

	@Override
	public int findUsrNum(String hsl, Object[] objs) {
		return userDao.find(hsl,objs,null).size();
	}
	

	@Override
	public int findUsrNum(String hsl) {
		// TODO Auto-generated method stub
		return 0;
	}
	@Override
	public List<User> find(String hsl, Object[] objs, PageBean pageBean) {
		return userDao.find(hsl,objs,pageBean);
	}




    
    





	

	
	

	
}